// cncrelief.com Relief - import button for ZBrush 4R8 ... 2025 (Windows).
// Make the relief with "cncrelief Bridge" first. This button brings it into ZBrush as a new Tool.
// Load once: Zscript > Load > this file. For every start: copy the made cncrelief_import.zsc to
// ZBrush \ ZStartup \ ZPlugs64 (see README.txt).

[VarDef, cncFile, ""]
[VarDef, cncHave, 0]

[ISubPalette, "Zplugin:cncrelief"]

[IButton, "Zplugin:cncrelief:Import Relief", "Imports the last relief made by cncrelief Bridge as a new Tool",
	[VarSet, cncFile, "C:/Users/Public/Documents/cncrelief/cncrelief_relief.obj"]
	[VarSet, cncHave, [FileExists, cncFile]]
	[If, cncHave == 0,
		[VarSet, cncFile, [FileNameAsk, "OBJ (*.obj)|*.obj||", , "Choose the relief OBJ (made by cncrelief Bridge)"]]
	]
	[If, [StrLength, cncFile],
		[IPress, Tool:PolyMesh3D]
		[FileNameSetNext, cncFile]
		[IPress, Tool:Import]
		[Note, "Relief imported as a Tool.\nDraw it on the canvas (click and drag), then press Edit (T).", , 4]
	]
, 0, 1]

[IButton, "Zplugin:cncrelief:Import Other", "Choose any relief OBJ made by cncrelief Bridge (Public Documents > cncrelief)",
	[VarSet, cncFile, [FileNameAsk, "OBJ (*.obj)|*.obj||", , "Choose the relief OBJ"]]
	[If, [StrLength, cncFile],
		[IPress, Tool:PolyMesh3D]
		[FileNameSetNext, cncFile]
		[IPress, Tool:Import]
		[Note, "Relief imported as a Tool.\nDraw it on the canvas (click and drag), then press Edit (T).", , 4]
	]
, 0, 1]
